#include <iostream>
#include <stdlib.h>

using namespace std;

struct List
{ int number;
  int score;
  List* next;
};

List* Creat_list(int tn)
{
    List* p;List* p1;
    p=(List*)malloc(sizeof(List));
    p->next=NULL; 
    List* head=p;

    if(p==NULL) cout<<"error the store is not enough"<<endl;
      
    else
    {     
        for(int i=1;i<tn;i++)
        {
            
            p1=(List*)malloc(sizeof(List));
            p1->next=NULL;
            p->next=p1;
            p=p1;
        }
        p=head;
        for(int i=1;i<=tn;i++)
        {
            cout<<"the number and score:"<<endl;
            cin>>p->number>>p->score;
            p=p->next;
        }

    }
    return head;
}

List* Contact_list(List* head1,List* head2)
{
    List* p;
    p=head1;
    while(head1->next!=NULL)
    {
         head1=head1->next;
    }

    head1->next=head2;
    return p;
}
   

void displayList(List* head)
{
    List* p=head;
    while(p->next!=NULL)
    {
        cout<<p->number<<p->score<<endl;
        p=p->next;
    }
    cout<<p->number<<p->score;
}

int main()
{
    List* head;List* head1;List* head2;
    int tn;
    cout<<"the first class number of student"<<endl;
    cin>>tn;
    head1=Creat_list(tn);
    cout<<"the second class number of student"<<endl;
    cin>>tn;
    head2=Creat_list(tn);

    head=Contact_list(head1,head2);
    displayList(head);
    
    system("pause");
    return 0;
}
